{% extends "admin.base.html" %}
{% block adminbody %}
	<h1>MOKO Top Girl</h1><span>[{{count}}]</span>
	{% if models %}
	<div id="topgirlgallery">
		<form name="modelform" method="POST" action="{{request.path}}">
		<div class="commands">
		<ul>
		{% if topgirl %}
			<li><a href="{{request.path}}" class="button"><span>Show Models</span></a></li>
		{% else %}
			<li>Show <a href="{{request.path}}?target=gender&with=0" class="button"><span>Girls</span></a>|
					 <a href="{{request.path}}?target=mtg&with=1" class="button"><span>Top Girls</span></a>|
					 <a href="{{request.path}}?target=mtg&with=0" class="button"><span>Top Girls (pending)</span></a>|
					 <a href="{{request.path}}?target=iphone&with=1" class="button"><span>MTG For iPhone</span></a> |
					 <a href="{{request.path}}?target=iphone&with=0" class="button"><span>MTG (non iPhone)</span></a>
			</li>
		{% endif %}
			<li><a href="#" class="button" onclick="javascript:selectallmtg();"><span>Select All: MTG</span></a></li>
			<li><a href="#" class="button" onclick="javascript:clearallmtg();"><span>Clear All: MTG</span></a></li>
			<li><a href="#" class="button" onclick="javascript:selectalliphone();"><span>Select All: iPhone</span></a></li>
			<li><a href="#" class="button" onclick="javascript:clearalliphone();"><span>Clear All: iPhone</span></a></li>
		</ul>
		</div>
		{% if pages %}
	<div class="pager">
		<ul>
		{% for p in pages %}
		{% ifequal p page %}
		<li class="cpage">{{p}}</li>
		{% else %}
		<li><a href="{{request.path}}?page={{p}}&target={{target}}&with={{operation}}">{{p}}</a></li>
		{% endifequal %}
		{% endfor %}
		</ul>
	</div>
	{% endif %}	
		<ul class="gallery">
		{% for model in models %}
		<li class="model">
			{% if model.avatar %}
			<a href="/admin/album/{{ model.username}}">
				<img class="avatar" src="{{host_img}}/{{model.username}}/{{model.avatar|imagename}}" alt="{{model.name}}">
			</a>
			{% endif %}
			<div class="name">&gt;<a class="mokolink" title="mobile top girl:{{model.name}}" href="/admin/album/{{ model.username}}">{{model.name_cn}}/{{model.name_en}}</a></div>
			<div {% ifequal model.get_album_count 0 %} class="warn" {% endifequal %}>album:{{model.get_album_count}}/{{model.get_album_iphone_count}}|<a href="/model/{{model.username}}?action=update">Fetch Now</a></div>
			<div><span class='warn'>[photos:{{model.get_photo_count}}|{{model.get_moko_photo_count}}@moko]</span></div>
			<div class="command">
				<span><a class="mokolink" href="/admin/model/{{model.username}}">Edit Detail</a></span>
			</div>
			<div class="form">
			<input type="hidden" id="model_{{model.username}}" name="model_{{model.username}}" value="1"/>
			{% if not model.mtg %}
				<input type="checkbox" id="mtg_{{model.username}}" name="mtg_{{model.username}}"/>MTG
			{% else %}
				<input type="checkbox" id="mtg_{{model.username}}" name="mtg_{{model.username}}" {% if model.mtg %} checked="true"{% endif %}/>MTG
				<input type="checkbox" id="iphone_{{model.username}}" name="iphone_{{model.username}}" {% if model.iphone %} checked="true" {% endif %} />iPhone
			{% endif %}
			</div>
		</li>
		{% endfor %}
		</ul>
		{% if topgirl %}
		<input type="hidden" name="topgirl" value="{{topgirl}}" />
		<input type="hidden" name="target" value="{{target}}"/>
		<input type="hidden" name="with" value="{{operation}}"/>
		<input type="hidden" name="page" value="{{p}}"/>
		{% endif %}
		{% if page %}
		<input type="hidden" name="page" value="{{page}}" />
		{% endif %}
		<input type="submit" value="Submit!" name="Submit"/>
		</form>
	</div>
	{% endif %}
	{% if pages %}
	<div class="pager">
		<ul>
		{% for p in pages %}
		{% ifequal p page %}
		<li class="cpage">{{p}}</li>
		{% else %}
		<li><a href="{{request.path}}?page={{p}}&target={{target}}&with={{operation}}">{{p}}</a></li>
		{% endifequal %}
		{% endfor %}
		</ul>
	</div>
	{% endif %}	
{% endblock %}